#include "SkipList.h"
#include <cstdint>

static const int randMax = 100000;

void test1()
{
    SkipList *sl = new SkipList(randMax);
    for (int i = 0; i < 20; ++i)
    {
        int num = random() % randMax;
        if (!sl->insert(num))
        {
            cout << "repeated " << num;
        }
    }
    cout << "----------------------" << endl;
    sl->dumpAllNodes();
}

void test2()
{
    SkipList *sl = new SkipList(randMax);
    for (int i = 0; i < 20; ++i)
    {
        sl->insert(i);
    }
    sl->dumpAllNodes();
    sl->remove(5);
    sl->remove(10);
    sl->dumpAllNodes();
    SLNode *tmp = sl->search(15);
    if (nullptr == tmp) return;
    tmp->output();
}

int main(int argc, char **argv)
{
    //test1();
    test2();
    return 0;
}